<template>
<div class="examListContainer">
<!--  这里实现测试连接，并不是对应得试卷-->
  <div class="hd">{{subject}}试卷</div>
  <div v-for="(item,key) in examList" :key="key" class="list" @click="toBeingExam(item.paperId,item.paperName)">
  <a class="weui-cell  weui-cell_access" href="">
    <div class="weui-cell__bd">
      <p>{{key+1}}. {{item.paperName}}</p>
    </div>
    <div class="weui-cell__ft">进入</div>
  </a>
  </div>
</div>
</template>

<script>
import HttpKit from '@/utils/http-kit'
import globalStore from "../../stores/global-store";
// const EXAM_LIST_URL = 'http://112.74.105.17:20003/question-bank'
const EXAM_LIST_URL = 'http://127.0.0.1:8080/base-in-back-end'
export default {
  data () {
    return {
      examList: [],
      subject: ''
    }
  },
  beforeMount() {
    this.subject = globalStore.state.examType[2]
    this.detail()
  },
  methods: {
      detail() {
        // 根据学科、年级、年级分类查询试卷
        let that = this
        this.$fly.post(EXAM_LIST_URL + '/common/paper/page/value',{
          data : {
            paperGrade: globalStore.state.examType[1],
            paperSubject: globalStore.state.examType[2],
            paperType: globalStore.state.examType[0]
          },
          limit: 10,
          start: 1
        })
          .then(e => {
            console.log(e)
            that.examList = e.data.data.data
            console.log(this.examList[0].paperName)
          })
          .catch(err => {
          })
      },
    toBeingExam(paperId,paperName){
        globalStore.state.paperName = paperName
        globalStore.state.paperId = paperId
        console.log(globalStore.state.paperName)
        wx.navigateTo({
          url: '/pages/beingExam/main?paperId=' + paperId
        })
    }
    },
}

</script>

<style scoped>
.hd {
  margin: 20px auto;
  text-align: center;
}
.list {
  width: 90%;
  border: 1px solid #669999;
  margin: 5px auto;
}
</style>
